package com.kmproject.haifu.mvp.presenter;

import android.Manifest;
import android.app.Activity;
import android.app.Application;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.alibaba.sdk.android.oss.ServiceException;
import com.alibaba.sdk.android.oss.model.PutObjectResult;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.jess.arms.di.scope.ActivityScope;
import com.jess.arms.http.imageloader.ImageLoader;
import com.jess.arms.http.imageloader.glide.ImageConfigImpl;
import com.jess.arms.integration.AppManager;
import com.jess.arms.mvp.BasePresenter;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.PermissionUtil;
import com.jess.arms.widget.CustomPopupWindow;
import com.jess.arms.widget.autolayout.AutoToolbar;
import com.kmproject.haifu.R;
import com.kmproject.haifu.app.hfinterface.AliYunUploadFileInterface;
import com.kmproject.haifu.app.utils.AppUtil;
import com.kmproject.haifu.app.utils.RxUtils;
import com.kmproject.haifu.mvp.contract.MyStoryAddStoryContract;
import com.kmproject.haifu.mvp.model.api.Api;
import com.kmproject.haifu.mvp.model.entity.ResultBean;
import com.kmproject.haifu.mvp.model.entity.beans.HousePayWayBean;
import com.kmproject.haifu.mvp.model.entity.beans.MyStoryBean;
import com.kmproject.haifu.mvp.model.entity.resbean.StoreAddParmarBean;
import com.kmproject.haifu.mvp.model.entity.resbean.StoryImageType;
import com.kmproject.haifu.mvp.ui.adapter.MyStoryAddStorySelectTypeAdapter;

import java.io.File;
import java.util.List;

import javax.inject.Inject;

import butterknife.BindView;
import butterknife.ButterKnife;
import me.jessyan.rxerrorhandler.core.RxErrorHandler;
import me.jessyan.rxerrorhandler.handler.ErrorHandleSubscriber;


/**
 * ================================================
 * Description:
 * <p>
 * Created by MVPArmsTemplate on 07/29/2019 14:40
 * <a href="mailto:jess.yan.effort@gmail.com">Contact me</a>
 * <a href="https://github.com/JessYanCoding">Follow me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms">Star me</a>
 * <a href="https://github.com/JessYanCoding/MVPArms/wiki">See me</a>
 * <a href="https://github.com/JessYanCoding/MVPArmsTemplate">模版请保持更新</a>
 * ================================================
 */
@ActivityScope
public class MyStoryAddStoryPresenter extends BasePresenter<MyStoryAddStoryContract.Model, MyStoryAddStoryContract.View> {
    @Inject
    RxErrorHandler mErrorHandler;
    @Inject
    Application mApplication;
    @Inject
    ImageLoader mImageLoader;
    @Inject
    AppManager mAppManager;
    String[] permission = {Manifest.permission.READ_PHONE_STATE, Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION,
            Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA, Manifest.permission.VIBRATE};
    private CustomPopupWindow customPopupWindowToXZDP;//选择身份证或护照
    private PopuwindowXZDPViewHold popuwindowViewHold;
    private String idCardFront, idCardReverseSide, passport, businessLicense;

    private CustomPopupWindow customPopupWindowToYYZZ;//选择营业执照
    private PopuwindowYYZZViewHold popuwindowViewHoldYYZZ;

    @Inject
    public MyStoryAddStoryPresenter(MyStoryAddStoryContract.Model model, MyStoryAddStoryContract.View rootView) {
        super(model, rootView);
    }

    /**
     * 修改成功
     *
     * @param storeAddParmarBean
     */
    public void updateStore(String storeId, StoreAddParmarBean storeAddParmarBean) {
        mModel.updateStore(Api.APP_DOMAIN + "/app/userStore/updateStore/" + storeId, AppUtil.entityToMap(storeAddParmarBean)).compose(RxUtils.applySchedulers(mRootView))
                .subscribe(new ErrorHandleSubscriber<ResultBean<MyStoryBean>>(mErrorHandler) {
                    @Override
                    public void onNext(ResultBean<MyStoryBean> myStoryBeanResultBean) {
                        if (AppUtil.isSuccess(myStoryBeanResultBean)) {
                            mRootView.updateStoreSuccess(myStoryBeanResultBean.getData());
                        } else {
                            mRootView.showMessage(myStoryBeanResultBean.getMessage());
                        }
                    }
                });
    }

    /**
     * 提交店铺信息发布店铺
     *
     * @param storeAddParmarBean
     */
    public void addStore(StoreAddParmarBean storeAddParmarBean) {
        mModel.addStore(AppUtil.entityToMap(storeAddParmarBean)).compose(RxUtils.applySchedulers(mRootView))
                .subscribe(new ErrorHandleSubscriber<ResultBean<MyStoryBean>>(mErrorHandler) {
                    @Override
                    public void onNext(ResultBean<MyStoryBean> myStoryBeanResultBean) {
                        if (AppUtil.isSuccess(myStoryBeanResultBean)) {
//                           mRootView.showMessage(myStoryBeanResultBean.getMessage());
//                            AppUtil.midToast(AppManager.getAppManager().getCurrentActivity(), myStoryBeanResultBean.getMessage());
                            mRootView.addStoreSuccess(myStoryBeanResultBean.getMessage(),myStoryBeanResultBean.getData());
                        } else {
                            mRootView.showMessage(myStoryBeanResultBean.getMessage());
                        }
                    }
                });
    }

    /**
     * 获取店铺选择类型
     */
    public void dictList() {
        mModel.dictList(Api.STORE_TYPE, "").compose(RxUtils.applySchedulers(mRootView))
                .subscribe(new ErrorHandleSubscriber<ResultBean<List<HousePayWayBean>>>(mErrorHandler) {
                    @Override
                    public void onNext(ResultBean<List<HousePayWayBean>> listResultBean) {
                        if (AppUtil.isSuccess(listResultBean)) {
                            mRootView.dictListSuccess(listResultBean.getData());
                        } else {
                            mRootView.showMessage(listResultBean.getMessage());
                        }
                    }
                });
    }

    /**
     * 获取区域信息
     *
     * @param value
     * @param housePayWayBeans
     */
    public void getHouseArea(String value, List<HousePayWayBean> housePayWayBeans) {
        if (housePayWayBeans != null && !housePayWayBeans.isEmpty()) {
            mRootView.getHouseArea(housePayWayBeans);
            return;
        }
        mModel.getAreaTree(value, "").compose(RxUtils.applySchedulers(mRootView))
                .subscribe(new ErrorHandleSubscriber<ResultBean<List<HousePayWayBean>>>(mErrorHandler) {
                    @Override
                    public void onNext(ResultBean<List<HousePayWayBean>> listResultBean) {
                        if (AppUtil.isSuccess(listResultBean)) {
                            mRootView.getHouseArea(listResultBean.getData());
                        } else {
                            mRootView.showMessage(listResultBean.getMessage());
                        }
                    }
                });
    }

    /**
     * 上传图片
     *
     * @param file
     */
    public void updateHeadImg(StoryImageType type, File file) {
        AppUtil.upfileToAli(mAppManager.getCurrentActivity(), Api.houseSale_server_store, file.getPath(), new AliYunUploadFileInterface() {
            @Override
            public void AliYunUploadFileCallBackProgress(long currentSize, long totalSize) {

            }

            @Override
            public void AliYunUploadFileCallBackSuccess(PutObjectResult result, String serverPath) {
                if (StoryImageType.idCardFront.equals(type)) {
                    //身份证正面
                    idCardFront = serverPath;
                    popuwindowViewHold.storyAddstoryUpdateimgSfzzmImg.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            mRootView.getGlideImg().loadImage(mRootView.getStoryActivity(), ImageConfigImpl.builder().url(serverPath)
                                    .imageView(popuwindowViewHold.storyAddstoryUpdateimgSfzzmImg)
                                    .build());
                        }
                    }, 1000);

                } else if (StoryImageType.idCardReverseSide.equals(type)) {
                    //身份证背面
                    idCardReverseSide = serverPath;
                    popuwindowViewHold.storyAddstoryUpdateimgSfzbmImg.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            mRootView.getGlideImg().loadImage(mRootView.getStoryActivity(), ImageConfigImpl.builder().url(serverPath)
                                    .imageView(popuwindowViewHold.storyAddstoryUpdateimgSfzbmImg)
                                    .build());
                        }
                    }, 1000);

                } else if (StoryImageType.passport.equals(type)) {
                    //护照
                    passport = serverPath;
                    popuwindowViewHold.storyAddstoryUpdateimgHzImg.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            mRootView.getGlideImg().loadImage(mRootView.getStoryActivity(), ImageConfigImpl.builder().url(serverPath)
                                    .imageView(popuwindowViewHold.storyAddstoryUpdateimgHzImg)
                                    .build());
                        }
                    }, 1000);

                } else if (StoryImageType.businessLicense.equals(type)) {
                    //营业执照
                    businessLicense = serverPath;
                    popuwindowViewHoldYYZZ.storyAddstoryUpdateimgYyzzImg.postDelayed(new Runnable() {
                        @Override
                        public void run() {
                            mRootView.getGlideImg().loadImage(mRootView.getStoryActivity(), ImageConfigImpl.builder().url(serverPath)
                                    .imageView(popuwindowViewHoldYYZZ.storyAddstoryUpdateimgYyzzImg)
                                    .build());
                        }
                    }, 1000);

                }
                mRootView.updateImgSuccess(type, serverPath);
            }

            @Override
            public void AliYunUploadFileCallBackFailure(ServiceException serviceException) {

            }
        });
    }

    /**
     * 请求相机权限
     */
    public void requestPrisession() {
        //请求外部存储权限用于适配android6.0的权限管理机制
        PermissionUtil.requestPermission(new PermissionUtil.RequestPermission() {
            @Override
            public void onRequestPermissionSuccess() {
                mRootView.requestPerimissionSuccess();
            }

            @Override
            public void onRequestPermissionFailure(List<String> permissions) {
                mRootView.showMessage("请求相机权限失败");
            }

            @Override
            public void onRequestPermissionFailureWithAskNeverAgain(List<String> permissions) {
                mRootView.showMessage("请同意使用摄像头权限");
            }
        }, mRootView.getPermissions(), mErrorHandler, permission);
    }

    /**
     * 控制popu控制选择店铺
     */
    public void showPopuWindowToXZDPType(Activity activity, View view, List<HousePayWayBean> housePayWayBeans, ItemClick itemClick) {
        CustomPopupWindow customPopupWindowToXZDPType = new CustomPopupWindow.Builder().contentView(CustomPopupWindow.inflateView(activity, R.layout.story_addstory_selecttype)).parentView(view)
                .animationStyle(R.style.mypopwindow_anim_style).customListener(new CustomPopupWindow.CustomPopupWindowListener() {
                    @Override
                    public void initPopupView(View contentView) {

                    }
                }).isHaveBackGround(false).build();
        View view2 = customPopupWindowToXZDPType.getContentView();
        PopuwindowXZDPTypeViewHold popuwindowViewHoldXZLX = new PopuwindowXZDPTypeViewHold(view2);
        popuwindowViewHoldXZLX.toolbarTitle.setText(ArmsUtils.getString(activity, R.string.mystory_xzdplx));
        popuwindowViewHoldXZLX.toolbarTitle.setTextColor(ArmsUtils.getColor(activity, R.color.white));
        popuwindowViewHoldXZLX.toolbar.setBackgroundColor(ArmsUtils.getColor(activity, R.color.color_3F3F4B));
        popuwindowViewHoldXZLX.toolbarBackImg.setImageResource(R.drawable.member_center_main_back_img);
        popuwindowViewHoldXZLX.backRightTxt.setVisibility(View.GONE);
        MyStoryAddStorySelectTypeAdapter myStoryAddStorySelectTypeAdapter = new MyStoryAddStorySelectTypeAdapter(housePayWayBeans);
        popuwindowViewHoldXZLX.storyAddstorySelecttypeRecyclerView.setLayoutManager(new LinearLayoutManager(activity));
        popuwindowViewHoldXZLX.storyAddstorySelecttypeRecyclerView.setAdapter(myStoryAddStorySelectTypeAdapter);
        myStoryAddStorySelectTypeAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_RIGHT);
        myStoryAddStorySelectTypeAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                itemClick.callBack(position, housePayWayBeans.get(position));
                customPopupWindowToXZDPType.dismiss();
            }
        });
        popuwindowViewHoldXZLX.toolbarBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mRootView.getStoryActivity().finish();
                customPopupWindowToXZDPType.dismiss();
            }
        });
        customPopupWindowToXZDPType.show();

    }

    /**
     * 控制popu控制选择营业执照
     */
    public void showPopuWindowToYYZZ(Activity activity, View view) {

        customPopupWindowToYYZZ = new CustomPopupWindow.Builder().contentView(CustomPopupWindow.inflateView(activity, R.layout.story_addstory_updateimg_yyzz)).parentView(view)
                .animationStyle(R.style.mypopwindow_anim_style).customListener(new CustomPopupWindow.CustomPopupWindowListener() {
                    @Override
                    public void initPopupView(View contentView) {

                    }
                }).isHaveBackGround(false).build();
        View view1 = customPopupWindowToYYZZ.getContentView();
        popuwindowViewHoldYYZZ = new PopuwindowYYZZViewHold(view1);
        popuwindowViewHoldYYZZ.toolbarTitle.setText(ArmsUtils.getString(activity, R.string.mystory_scyyzz));
        popuwindowViewHoldYYZZ.toolbarTitle.setTextColor(ArmsUtils.getColor(activity, R.color.white));
        popuwindowViewHoldYYZZ.toolbar.setBackgroundColor(ArmsUtils.getColor(activity, R.color.color_3F3F4B));
        popuwindowViewHoldYYZZ.toolbarBackImg.setImageResource(R.drawable.member_center_main_back_img);
        popuwindowViewHoldYYZZ.backRightTxt.setVisibility(View.GONE);
        popuwindowViewHoldYYZZ.mystoreSelectstoryPopuwindowAddTxt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!TextUtils.isEmpty(businessLicense)) {
                    mRootView.getStoreAddParmarBean().setBusinessLicense(businessLicense);
                }
                if (mRootView.getStoreAddParmarBean().getBusinessLicense() != null && !TextUtils.isEmpty(mRootView.getStoreAddParmarBean().getBusinessLicense())) {
                    mRootView.getMystoryAddStoryYyzz().setText(ArmsUtils.getString(activity, R.string.housepublishpublish_yxz));
                }
                customPopupWindowToYYZZ.dismiss();
            }
        });
        popuwindowViewHoldYYZZ.toolbarBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                businessLicense = "";
                if (mRootView.getStoreAddParmarBean().getBusinessLicense() != null && !TextUtils.isEmpty(mRootView.getStoreAddParmarBean().getBusinessLicense())) {
                    mRootView.getMystoryAddStoryYyzz().setText(ArmsUtils.getString(activity, R.string.housepublishpublish_yxz));
                }
                customPopupWindowToYYZZ.dismiss();
            }
        });
        if (mRootView.getStoreAddParmarBean().getBusinessLicense() != null && !TextUtils.isEmpty(mRootView.getStoreAddParmarBean().getBusinessLicense())) {
            //营业执照
            mRootView.getGlideImg().loadImage(mRootView.getStoryActivity(), ImageConfigImpl.builder().url(mRootView.getStoreAddParmarBean().getBusinessLicense())
                    .imageView(popuwindowViewHoldYYZZ.storyAddstoryUpdateimgYyzzImg)
                    .build());
            popuwindowViewHoldYYZZ.MystoryUpdateYyzzTsTxt.setVisibility(View.VISIBLE);
        } else {
            popuwindowViewHoldYYZZ.MystoryUpdateYyzzTsTxt.setVisibility(View.GONE);
        }

        popuwindowViewHoldYYZZ.storyAddstoryUpdateimgYyzzImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mRootView.setSelectImgType(StoryImageType.businessLicense);
                requestPrisession();
            }
        });
        customPopupWindowToYYZZ.show();
    }

    /**
     * 控制popu控制选择身份证货护照
     */
    public void showPopuWindowToSFZ(Activity activity, View view) {
        customPopupWindowToXZDP = new CustomPopupWindow.Builder().contentView(CustomPopupWindow.inflateView(activity, R.layout.story_addstory_updateimg)).parentView(view)
                .animationStyle(R.style.mypopwindow_anim_style).customListener(new CustomPopupWindow.CustomPopupWindowListener() {
                    @Override
                    public void initPopupView(View contentView) {

                    }
                }).isHaveBackGround(false).build();
        View view1 = customPopupWindowToXZDP.getContentView();
        popuwindowViewHold = new PopuwindowXZDPViewHold(view1);
        popuwindowViewHold.toolbarTitle.setText(ArmsUtils.getString(activity, R.string.mystory_scsfzyhz));
        popuwindowViewHold.toolbarTitle.setTextColor(ArmsUtils.getColor(activity, R.color.white));
        popuwindowViewHold.toolbar.setBackgroundColor(ArmsUtils.getColor(activity, R.color.color_3F3F4B));
        popuwindowViewHold.toolbarBackImg.setImageResource(R.drawable.member_center_main_back_img);
        popuwindowViewHold.backRightTxt.setVisibility(View.GONE);
        popuwindowViewHold.mystoreSelectstoryPopuwindowAddTxt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (!TextUtils.isEmpty(idCardFront)) {
                    mRootView.getStoreAddParmarBean().setIdCardFront(idCardFront);
                }
                if (!TextUtils.isEmpty(passport)) {
                    mRootView.getStoreAddParmarBean().setPassport(passport);
                }
                if (!TextUtils.isEmpty(idCardReverseSide)) {
                    mRootView.getStoreAddParmarBean().setIdCardReverseSide(idCardReverseSide);
                }
                if (mRootView.getStoreAddParmarBean().getPassport() != null && !TextUtils.isEmpty(mRootView.getStoreAddParmarBean().getPassport())) {
                    mRootView.getMystoryAddStorySfz().setText(ArmsUtils.getString(activity, mRootView.getStoryActivity().getIntent().hasExtra("MyStoreMainBean")?R.string.housepublishpublish_ysc:R.string.housepublishpublish_yxz));
                }
                if (mRootView.getStoreAddParmarBean().getIdCardFront() != null && !TextUtils.isEmpty(mRootView.getStoreAddParmarBean().getIdCardFront())
                        && mRootView.getStoreAddParmarBean().getIdCardReverseSide() != null && !TextUtils.isEmpty(mRootView.getStoreAddParmarBean().getIdCardReverseSide())) {
                    mRootView.getMystoryAddStorySfz().setText(ArmsUtils.getString(activity, mRootView.getStoryActivity().getIntent().hasExtra("MyStoreMainBean")?R.string.housepublishpublish_ysc:R.string.housepublishpublish_yxz));
                }
                customPopupWindowToXZDP.dismiss();
            }
        });
        popuwindowViewHold.toolbarBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                idCardFront = "";
                passport = "";
                idCardReverseSide = "";
                if (mRootView.getStoreAddParmarBean().getPassport() != null && !TextUtils.isEmpty(mRootView.getStoreAddParmarBean().getPassport())) {
                    mRootView.getMystoryAddStorySfz().setText(ArmsUtils.getString(activity, R.string.housepublishpublish_yxz));

                }
                if (mRootView.getStoreAddParmarBean().getIdCardFront() != null && !TextUtils.isEmpty(mRootView.getStoreAddParmarBean().getIdCardFront())
                        && mRootView.getStoreAddParmarBean().getIdCardReverseSide() != null && !TextUtils.isEmpty(mRootView.getStoreAddParmarBean().getIdCardReverseSide())) {
                    mRootView.getMystoryAddStorySfz().setText(ArmsUtils.getString(activity, R.string.housepublishpublish_yxz));
                }
                customPopupWindowToXZDP.dismiss();
            }
        });
        if (mRootView.getStoreAddParmarBean().getIdCardFront() != null && !TextUtils.isEmpty(mRootView.getStoreAddParmarBean().getIdCardFront())) {
            //身份证正面
            mRootView.getGlideImg().loadImage(mRootView.getStoryActivity(), ImageConfigImpl.builder().url(mRootView.getStoreAddParmarBean().getIdCardFront())
                    .imageView(popuwindowViewHold.storyAddstoryUpdateimgSfzzmImg)
                    .build());
            popuwindowViewHold.MystoryUpdateSfzzmTsTxt.setVisibility(View.VISIBLE);
        }else {
            popuwindowViewHold.MystoryUpdateSfzzmTsTxt.setVisibility(View.GONE);
        }
        if (mRootView.getStoreAddParmarBean().getIdCardReverseSide() != null && !TextUtils.isEmpty(mRootView.getStoreAddParmarBean().getIdCardReverseSide())) {
            //身份证背面
            mRootView.getGlideImg().loadImage(mRootView.getStoryActivity(), ImageConfigImpl.builder().url(mRootView.getStoreAddParmarBean().getIdCardReverseSide())
                    .imageView(popuwindowViewHold.storyAddstoryUpdateimgSfzbmImg)
                    .build());
            popuwindowViewHold.MystoryUpdateSfzbmTsTxt.setVisibility(View.VISIBLE);
        }else {
            popuwindowViewHold.MystoryUpdateSfzbmTsTxt.setVisibility(View.GONE);
        }
        if (mRootView.getStoreAddParmarBean().getPassport() != null && !TextUtils.isEmpty(mRootView.getStoreAddParmarBean().getPassport())) {
            //护照
            mRootView.getGlideImg().loadImage(mRootView.getStoryActivity(), ImageConfigImpl.builder().url(mRootView.getStoreAddParmarBean().getPassport())
                    .imageView(popuwindowViewHold.storyAddstoryUpdateimgHzImg)
                    .build());
            popuwindowViewHold.MystoryUpdateHzTsTxt.setVisibility(View.VISIBLE);
        }else {
            popuwindowViewHold.MystoryUpdateHzTsTxt.setVisibility(View.GONE);
        }
        popuwindowViewHold.storyAddstoryUpdateimgSfzzmImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mRootView.setSelectImgType(StoryImageType.idCardFront);
                requestPrisession();
            }
        });
        popuwindowViewHold.storyAddstoryUpdateimgSfzbmImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mRootView.setSelectImgType(StoryImageType.idCardReverseSide);
                requestPrisession();
            }
        });
        popuwindowViewHold.storyAddstoryUpdateimgHzImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mRootView.setSelectImgType(StoryImageType.passport);
                requestPrisession();
            }
        });

        customPopupWindowToXZDP.show();

    }

    public static class PopuwindowYYZZViewHold {
        @BindView(R.id.toolbar_backImg)
        ImageView toolbarBackImg;
        @BindView(R.id.toolbar_back)
        RelativeLayout toolbarBack;
        @BindView(R.id.toolbar_title)
        TextView toolbarTitle;
        @BindView(R.id.back_right_icon)
        ImageView backRightIcon;
        @BindView(R.id.back_right_txt)
        TextView backRightTxt;
        @BindView(R.id.toolbar_right)
        RelativeLayout toolbarRight;
        @BindView(R.id.toolbar)
        AutoToolbar toolbar;
        @BindView(R.id.story_addstory_updateimg_yyzz_img)
        ImageView storyAddstoryUpdateimgYyzzImg;
        @BindView(R.id.mystore_selectstory_popuwindow_add_txt)
        TextView mystoreSelectstoryPopuwindowAddTxt;
        @BindView(R.id.Mystory_update_yyzzTs_txt)
        TextView MystoryUpdateYyzzTsTxt;

        public PopuwindowYYZZViewHold(View view) {
//            R.layout.story_addstory_updateimg_yyzz
            ButterKnife.bind(this, view);
        }
    }

    public static class PopuwindowXZDPTypeViewHold {
        @BindView(R.id.toolbar_backImg)
        ImageView toolbarBackImg;
        @BindView(R.id.toolbar_back)
        RelativeLayout toolbarBack;
        @BindView(R.id.toolbar_title)
        TextView toolbarTitle;
        @BindView(R.id.back_right_icon)
        ImageView backRightIcon;
        @BindView(R.id.back_right_txt)
        TextView backRightTxt;
        @BindView(R.id.toolbar_right)
        RelativeLayout toolbarRight;
        @BindView(R.id.toolbar)
        AutoToolbar toolbar;
        @BindView(R.id.story_addstory_selecttype_RecyclerView)
        RecyclerView storyAddstorySelecttypeRecyclerView;

        public PopuwindowXZDPTypeViewHold(View view) {
//            R.layout.story_addstory_selecttype
            ButterKnife.bind(this, view);
        }

    }

    public static class PopuwindowXZDPViewHold {
        @BindView(R.id.toolbar_backImg)
        ImageView toolbarBackImg;
        @BindView(R.id.toolbar_back)
        RelativeLayout toolbarBack;
        @BindView(R.id.toolbar_title)
        TextView toolbarTitle;
        @BindView(R.id.back_right_icon)
        ImageView backRightIcon;
        @BindView(R.id.back_right_txt)
        TextView backRightTxt;
        @BindView(R.id.toolbar_right)
        RelativeLayout toolbarRight;
        @BindView(R.id.toolbar)
        AutoToolbar toolbar;
        @BindView(R.id.story_addstory_updateimg_sfzzm_img)
        ImageView storyAddstoryUpdateimgSfzzmImg;
        @BindView(R.id.story_addstory_updateimg_sfzbm_img)
        ImageView storyAddstoryUpdateimgSfzbmImg;
        @BindView(R.id.story_addstory_updateimg_hz_img)
        ImageView storyAddstoryUpdateimgHzImg;
        @BindView(R.id.mystore_selectstory_popuwindow_add_txt)
        TextView mystoreSelectstoryPopuwindowAddTxt;
        @BindView(R.id.Mystory_update_sfzzmTs_txt)
        TextView MystoryUpdateSfzzmTsTxt;
        @BindView(R.id.Mystory_update_sfzbmTs_txt)
        TextView MystoryUpdateSfzbmTsTxt;
        @BindView(R.id.Mystory_update_hzTs_txt)
        TextView MystoryUpdateHzTsTxt;

        public PopuwindowXZDPViewHold(View view) {
//            R.layout.story_addstory_updateimg

            ButterKnife.bind(this, view);
        }

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mErrorHandler = null;
        this.mAppManager = null;
        this.mImageLoader = null;
        this.mApplication = null;
    }

    public interface ItemClick {
        void callBack(int index, HousePayWayBean housePayWayBean);
    }
}
